enum Barcode {
    case upc(Int, Int, Int, Int)// 四个Int代表不同的条形码部分
    case qrCode(String)// 字符串表示二维码信息
}

var productBarcode = Barcode.upc(8, 85909, 51226, 3)

switch productBarcode {
case .upc(let numberSystem, let manufacturer, let product, let check):
    print("UPC: \(numberSystem), \(manufacturer), \(product), \(check).")
case .qrCode(let productCode):
    print("QR code: \(productCode).")
}